use Operation;

package PlaceEntity;
@ISA = qw/Operation/;

sub init{
    my $self = shift;
    $self->dependencies(qw/LogManager/);
}

sub perform{    
    my $self = shift;
    my ($entity, $map, $pos, $cat) =   ($self->params->{ENTITY},
					$self->params->{MAP},
					$self->params->{POS},
					$self->params->{CATEGORY});

    
    my $lm = $self->{LogManager};
    $lm->log("Placing ".ref($entity)." in map ".$map." at ".$pos->[0]." ".$pos->[1]." in category ".$cat);
    # Tell the entity where it is
    $entity->place($map, $pos->[0], $pos->[1], $cat);
    

    my  $result = ActionResult->new("DONE", "OK");

    return $result;
}

1;
